package com.spic.business.train.autonomic.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.spic.common.core.annotation.Excel;
import lombok.Data;

import java.util.Date;

/**
 * 课件自主学习对象 train_autonomic_learning
 *
 * @author spic
 * @date 2021-10-21
 */
@Data
public class TrainAutonomicLearning
{
    private static final long serialVersionUID = 1L;

    /** 主键id */
    @TableId(type = IdType.AUTO)
    private Long id;

    /** 培训信息id */
    @Excel(name = "培训信息id")
    private Long trainUserId;

    /** 课件id */
    private String coursewareId;

    /** 课件名称 */
    @Excel(name = "课件名称")
    @TableField(exist = false)
    private String coursewareName;

    /** 课件名称 */
    @Excel(name = "培训名称")
    @TableField(exist = false)
    private String trainName;

    /** 课件访问地址**/
    @TableField(exist = false)
    private String coursewareUrl;

    /** 计划学习时长 */
    @Excel(name = "计划学习时长")
    private int trainTime;

    /** 开始时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date startTime;

    /** 完成时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @Excel(name = "完成时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date endTime;

    /** 总学习百分比 */
    @Excel(name = "0-100")
    private int schedule;

    /** 实际学习时间**/
    @TableField(exist = false)
    private int realityTrainTime;

    /** 实际课件学习进度**/
    @TableField(exist = false)
    private double  realityFileProgress;

    @TableField(exist = false)
    private String ext;

    @TableField(exist = false)
    private String userId;

    /**
     * 是否完成进度
     * @return
     */
    public boolean isFinished() {
        return schedule == 100;
    }
}
